

package com.lry.basic.disruptor;

import com.lmax.disruptor.WorkHandler;


public class HmilyDisruptorWorkHandler<T> implements WorkHandler<DataEvent<T>> {

    private DisruptorConsumer<T> consumer;

    HmilyDisruptorWorkHandler(final DisruptorConsumer<T> consumer) {
        this.consumer = consumer;
    }

    @Override
    public void onEvent(final DataEvent<T> t) {
        if (t != null) {
            consumer.execute(t.getT());
        }
    }
}
